﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ModelLayer
{
    [DataContract]
    public class Airport
    {
        [DataMember]
        public string AirportCode { get; set; }
        [DataMember]
        public string AirportName { get; set; }
        [DataMember]
        public string Country { get; set; }
        [DataMember]
        public string City { get; set; }

        public Airport()
        {
            
        }
        //Overrides equals to compare airport objects by their airportCode
        public override bool Equals(object _obj)
        {
            bool equal = false;
            Airport objAirport = (Airport)_obj;

            if (AirportCode.Equals(objAirport.AirportCode))
            {
                equal = true;
            }
            return equal;
        }
        //To represent the object in a string
        public override string ToString()
        {
            return string.Format("Airport code: {0} \n Airport name: {1} \n Country: {2} \n City: {3}", AirportCode, AirportName, Country, City);
        }
    }
}
